package com.itany.corejava.day04;

import java.util.Scanner;

public class Test6 {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);

        int num=(int)(Math.random()*(1000-0+1))+0;

        System.out.println(num);

        int i=0;
        do {

            System.out.println("还有"+(10-i)+"次机会，请输入猜的数字[0-1000]:");

            int guessNumber=sc.nextInt();

            if(guessNumber<num){
                System.out.println("太小了，再大一点");
            }

            if(guessNumber>num){
                System.out.println("太大了，再小一点");
            }

            if(guessNumber==num){
                System.out.println("恭喜你，猜对了");
                break;
            }
            i++;
        }while(i<10);

        if(i==10) {
            System.out.println("你太笨了，下次再来");
        }


    }


}
